#include<iostream>
#include"connection.h"
#include"CommonConnectionPool.h"
using namespace std;
int main()
{
	//Connection conn;

	//conn.connect("127.0.0.1", 3306, "root", "az07212195", "chat");
	//conn.update(sql);
	clock_t begin = clock();
	ConnectionPool* cp = ConnectionPool::getConnectionPool();
	for (int i = 0; i < 1000; ++i)
	{
		auto conn = cp->getConnection();
		char sql[1024] = { 0 };
		sprintf(sql, "insert into user(name,age,sex) values('%s',%d,'%s')",
			"zhang san", 20, "male");
		conn->update(sql);
	}
	clock_t end = clock();
	cout << (end - begin) << "ms" << endl;
	return 0;
}